from rest_framework import serializers

from apps.goods.models import SKUImage, SKU


class SKUImageSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKUImage
        fields = '__all__'


    # def create(self, validated_data):
    #     # 创建模型类对象 保存到数据库
    #
    #
    #     pass



# 序列化  把模型类数据 转  字典
# 反序列化 字典 转 模型类数据

class SKUSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKU
        fields = ['id', 'name']
